import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class LoveSendIdolManageService {

  serviceUrls: any = {
    queryLoveActSendIdolListUrl: '/recycleActivityIdol/list', // 查询回收送爱豆 List
    saveLoveActSendIdolUrl: '/recycleActivityIdol/save', // 添加回收送爱豆
    updateLoveActSendIdolUrl: '/recycleActivityIdol/update', // 编辑回收送爱豆
    queryLoveActSendIdolDetailsUrl: '/recycleActivityIdol/details', // 查询回收送爱豆详情
    queryLoveIdolSendRecordListUrl: '/recycleActivityIdolRecord/list' // 查询爱豆回收记录
  };

  constructor(public httpClient: HttpClient) { }

  // 查询回收送爱豆 List
  getLoveActSendIdolList(params: any) {
    return this.httpClient.post(this.serviceUrls.queryLoveActSendIdolListUrl, params).toPromise();
  }

  /**
   * 新增 | 编辑 回收送爱豆
   * @param params 
   */
  editLoveActSendIdolData(params: any) {
    const url = params?.id ? this.serviceUrls.updateLoveActSendIdolUrl : this.serviceUrls.saveLoveActSendIdolUrl;
    return this.httpClient.post(url, params).toPromise();
  }

  // 查询回收送爱豆详情
  getLoveActSendIdolDetails(params: any) {
    return this.httpClient.get(this.serviceUrls.queryLoveActSendIdolDetailsUrl, { params }).toPromise();
  }

  // 查询爱豆回收记录
  getLoveIdolSendRecordList(params: any) {
    return this.httpClient.post(this.serviceUrls.queryLoveIdolSendRecordListUrl, params).toPromise();
  }
}



